package entity

import (
	"github.com/google/uuid"
	"gorm.io/gorm"
)

type Workflow struct {
	ID        string `json:"id" gorm:"column:id"`
	Name      string `json:"name" yaml:"name" gorm:"column:name"`
	ProjectID string `json:"project_id" gorm:"column:project_id"`
	DSL       string `json:"dsl" gorm:"column:dsl"`
	Step      int    `json:"step" gorm:"column:step"`
	Interval  int    `json:"interval" gorm:"column:interval"`
}

func (w *Workflow) TableName() string {
	return "workflows"
}

func (w *Workflow) BeforeCreate(tx *gorm.DB) (err error) {
	w.ID = uuid.NewString()
	return
}
